<?php
/*
 * @Author: your name
 * @Date: 2021-11-02 20:43:06
 * @LastEditTime: 2022-02-23 22:15:43
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \property\routes\adminApi.php
 */

use Illuminate\Support\Facades\Route;
use App\Http\Controllers\admin_controller\Login;                 //登录类
use App\Http\Controllers\admin_controller\CheckRole;             //检查登录状态
use App\Http\Controllers\admin_controller\Upload;                //上传类
use App\Http\Controllers\admin_controller\Teaching;              //教培公司类
use App\Http\Controllers\admin_controller\Role;                  //权限类         
use App\Http\Controllers\admin_controller\Admins;                //内部人员管理类
use App\Http\Controllers\admin_controller\Area;                  //区域管理
use App\Http\Controllers\admin_controller\Building;              //大厦管理
use App\Http\Controllers\admin_controller\Store;                 //店铺管理
use App\Http\Controllers\admin_controller\Housing;               //房源管理
use App\Http\Controllers\admin_controller\FindShopSettngs;       //招商办设置
use App\Http\Controllers\admin_controller\FreeDistribution;      //房源审核
use App\Http\Controllers\admin_controller\FindShopSubscribe;     //预约看房
use App\Http\Controllers\admin_controller\DailyParttimeUser;     //美日兼职用户
use App\Http\Controllers\admin_controller\CrmDivision;           //crm系统所属部门
use App\Http\Controllers\admin_controller\OperationLog;          //操作日志
use App\Http\Controllers\admin_controller\CrmOperationLog;        //CRM系统操作日志
use App\Http\Controllers\admin_controller\CrmRole;                //操作日志


// Route::get('/user', [UserController::class, 'index']);
/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/




Route::any('/login', [Login::class, 'index']);        //登录


Route::post('/loginOut', [Login::class, 'loginOut'])->name('退出登录');  //退出登录
Route::middleware('writelog')->group(function () { 
Route::any('/test', function () {
    
    // $laravel = app();
    // echo $a;
    // abort(400);
    // return "Your Laravel version is ".$laravel::VERSION;

//    echo 5557777;
});
});
// Route::any('/test1', [Login::class, 'test1']);



Route::middleware('CheckAdminToken')->group(function () {                       //检查是否登录
    Route::middleware('writelog')->group(function () {                           //日志中间件
        Route::post('/getRoute', [CheckRole::class, 'getRoute'])->name('登录');                   //获取路由信息

        Route::post('/checkRole', [CheckRole::class, 'CheckRole']);   //获取权限信息

        Route::prefix('/teaching')->group(function () {
            Route::post('/uploadOneFile', [Upload::class, 'uploadOneFile']);      //上传文件
            Route::post('/teachingList', [Teaching::class, 'teachingList']);      //教培公司列表
            Route::post('/teachingGoupBy', [Teaching::class, 'teachingGoupBy']);  //教培公司分类
            Route::post('/teachingUpdate', [Teaching::class, 'teachingUpdate'])->name('教培公司/编辑');  //教培公司编辑
            Route::post('/teachingAdd', [Teaching::class, 'teachingAdd'])->name('教培公司/添加');        //教培公司添加
            Route::post('/teachingSelOne', [Teaching::class, 'teachingSelOne']);  //教培公司查单条数据
        });


        Route::prefix('/role')->group(function () {
            Route::post('/roleList', [Role::class, 'roleList']);            //权限列表
            Route::post('/roleAdd', [Role::class, 'roleAdd'])->name('权限/添加');              //权限添加
            Route::post('/roleEdit', [Role::class, 'roleEdit'])->name('权限/编辑');            //权限编辑
            Route::post('/roleSelOne', [Role::class, 'roleSelOne']);        //权限查单条
            Route::post('/permission', [Role::class, 'permission']);        //权限树
        });

        Route::prefix('/admin')->group(function () {
            Route::post('/adminRoleList', [Role::class, 'roleList']);                //添加修改时权限列表
            Route::post('/adminSelOne', [Admins::class, 'adminSelOne']);             //查询用户信息一条
            Route::post('/adminList', [Admins::class, 'adminList']);                 //用户信息列表
            Route::post('/adminAdd', [Admins::class, 'adminAdd'])->name('用户/添加');                   //用户信息添加
            Route::post('/adminEdit', [Admins::class, 'adminEdit'])->name('用户/编辑');                 //用户信息编辑
            Route::post('/checkUserName', [Admins::class, 'checkUserName']);         //检查用户名重复
            Route::post('/adminAvatar', [Upload::class, 'uploadOneFile']);           //头像上传
            Route::post('/selectList', [Admins::class, 'selectList']);               //选择列表


            Route::post('/mineMsg', [Admins::class, 'mineMsg']);                     //个人中心查询




        });

        Route::prefix('/area')->group(function () {
            Route::post('/areaAdd', [Area::class, 'areaAdd'])->name('区域/添加');                  //区域管理添加
            Route::post('/areaEdit', [Area::class, 'areaEdit'])->name('区域/编辑');                //区域管理编辑
            Route::post('/areaList', [Area::class, 'areaList']);                //区域管理列表
            Route::post('/areaSelOne', [Area::class, 'areaSelOne']);            //区域管理查单条数据
            Route::post('/areaSelList', [Area::class, 'areaSelList']);          //上下级
        });

        Route::prefix('/building')->group(function () {
            Route::post('/buildingAdd', [Building::class, 'buildingAdd'])->name('找商办大厦/添加');                  //大厦添加
            Route::post('/buildingEdit', [Building::class, 'buildingEdit'])->name('找商办大厦/编辑');                //大厦编辑
            Route::post('/buildingList', [Building::class, 'buildingList']);                //大厦列表
            Route::post('/buildingSelOne', [Building::class, 'buildingSelOne']);            //大厦查单条
            Route::post('/buildingBatchEdit', [Building::class, 'buildingBatchEdit'])->name('找商办大厦/批量编辑');      //大厦批量
            Route::post('/buildingSelectList', [Building::class, 'buildingSelectList']);      //大厦查询

            Route::post('/manyImage', [Upload::class, 'manyFile']);                           //多图上传
            Route::post('/coverImage', [Upload::class, 'uploadOneFile']);                           //多图上传
        });

        Route::prefix('/store')->group(function () {
            Route::post('/storeAdd', [Store::class, 'storeAdd'])->name('找商办店铺/添加');                  //店铺添加
            Route::post('/storeEdit', [Store::class, 'storeEdit'])->name('找商办店铺/编辑');                //店铺编辑
            Route::post('/storeList', [Store::class, 'storeList']);                //店铺列表
            Route::post('/storeSelOne', [Store::class, 'storeSelOne']);            //店铺查单条
            Route::post('/storeBatchEdit', [Store::class, 'storeBatchEdit'])->name('找商办店铺/批量编辑');      //店铺批量
            Route::post('/storeAdminSelect', [Store::class, 'storeAdminSelect']);   //店铺负责人列表
            Route::post('/storeTagList', [Store::class, 'storeTagList']);           //标签列表b
            Route::post('/manyImage', [Upload::class, 'manyFile']);               //多图上传
            Route::post('/coverImage', [Upload::class, 'uploadOneFile']);          //多图上传
        });


        Route::prefix('/housing')->group(function () {
            Route::post('/housingAdd', [Housing::class, 'housingAdd'])->name('找商办房源/添加');                   //店铺添加
            Route::post('/housingEdit', [Housing::class, 'housingEdit'])->name('找商办房源/编辑');                 //店铺编辑
            Route::post('/housingList', [Housing::class, 'housingList']);                 //店铺列表
            Route::post('/housingSelOne', [Housing::class, 'housingSelOne']);             //店铺查单条
            Route::post('/housingBatchEdit', [Housing::class, 'housingBatchEdit'])->name('找商办房源/批量编辑');       //店铺批量
            Route::post('/housingAdminSelect', [Housing::class, 'housingAdminSelect']);   //店铺负责人列表
            Route::post('/housingTagList', [Housing::class, 'housingTagList']);           //标签列表
            Route::post('/manyImage', [Upload::class, 'manyFile']);                       //多图上传
            Route::post('/coverImage', [Upload::class, 'uploadOneFile']);                 //多图上传
        });

        Route::prefix('/dailyParttimeUser')->group(function () {
            Route::post('/userList', [DailyParttimeUser::class, 'userList']);                                               //用户列表
            Route::post('/userBind', [DailyParttimeUser::class, 'userBind'])->name('美日兼职客服/绑定');                   //美日兼职客服绑定
            Route::post('/clearUserBind', [DailyParttimeUser::class, 'clearUserBind'])->name('美日兼职客服/解绑');          //美日兼职客服解绑

        });

        Route::prefix('/findShopSettings')->group(function () {
            Route::post('/settingSelOne', [FindShopSettngs::class, 'settingSelOne']);                                        //店铺添加
            Route::post('/settingsEdit',   [FindShopSettngs::class, 'settingsEdit'])->name('找商办设置/编辑');                //店铺编辑
        });


        Route::prefix('/upload')->group(function () {
            Route::post('/uploadOneFile', [Upload::class, 'uploadOneFile']);     //上传文件
            Route::post('/manyFile', [Upload::class, 'manyFile']);               //多个文件
        });


        Route::prefix('/freeDistribution')->group(function () {
            Route::post('/freeDistributionEdit', [FreeDistribution::class, 'freeDistributionEdit'])->name('找商办审核房源/编辑');                   //免费发布编辑
            Route::post('/freeDistributionSelOne', [FreeDistribution::class, 'freeDistributionSelOne']);               //免费发布查单条
            Route::post('/freeDistributionList', [FreeDistribution::class, 'freeDistributionList']);                   //免费发布列表
            Route::post('/freeDistributionBatchEdit', [FreeDistribution::class, 'freeDistributionBatchEdit'])->name('找商办审核房源/批量编辑');         //免费发布批量编辑
        });

        Route::prefix('/crmDivision')->group(function () {
            Route::post('/divisionAdd', [CrmDivision::class, 'divisionAdd'])->name('crm部门管理/添加');                   //部门编辑
            Route::post('/divisionEdit', [CrmDivision::class, 'divisionEdit'])->name('crm部门管理/编辑');                 //免费发布查单条
            Route::post('/divisionSelOne', [CrmDivision::class, 'divisionSelOne']);                                      //免费发布列表
            Route::post('/divisionList', [CrmDivision::class, 'divisionList']);                                           //免费发布批量编辑
        });


        Route::prefix('/subscribe')->group(function () {
            Route::post('/subscribeList', [FindShopSubscribe::class, 'subscribeList']);                                               //预约看房

            Route::post('/subscribeEdit', [FindShopSubscribe::class, 'subscribeEdit'])->name('找商办预约看房/编辑');                   //预约看房编辑
            Route::post('/subscribeSelOne', [FindShopSubscribe::class, 'subscribeSelOne']);                                           //预约看房查单条
            Route::post('/subscribeBatchEdit', [FindShopSubscribe::class, 'subscribeBatchEdit'])->name('找商办预约看房/批量编辑');      //预约看房批量编辑
        });
     
        Route::prefix('/crmRole')->group(function () {
            Route::post('/permissionList', [CrmRole::class, 'permission']);                            //栏目树形列表    
            Route::post('/roleAdd', [CrmRole::class, 'roleAdd'])->name('crm权限/添加');                 //权限添加
            Route::post('/roleList', [CrmRole::class, 'roleList']);                                     //权限列表
            Route::post('/roleEdit', [CrmRole::class, 'roleEdit'])->name('crm权限/编辑');               //crm权限编辑
            Route::post('/roleSelOne', [CrmRole::class, 'roleSelOne']);                                 //权限查单条
            Route::post('/roleSelectList', [CrmRole::class, 'roleSelectList']);                          //crm权限列表

            
        });


        Route::prefix('/operationLog')->group(function(){
            Route::post('/operationLogList', [OperationLog::class, 'operationLogList']);                                   //日志
        });
       
        Route::prefix('/crmOperationLog')->group(function(){
            Route::post('/operationLogList', [CrmOperationLog::class, 'operationLogList']);                                   //日志
        });
    });
});
